package cn.iocoder.yudao.module.bpm.dal.mysql.sourceapply;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.sourceapply.vo.SourceApplyPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.sourceapply.SourceApplyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资源申请 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SourceApplyMapper extends BaseMapperX<SourceApplyDO> {

    default PageResult<SourceApplyDO> selectPage(SourceApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SourceApplyDO>()
                .eqIfPresent(SourceApplyDO::getApplyCode, reqVO.getApplyCode())
                .eqIfPresent(SourceApplyDO::getApplyUserId, reqVO.getApplyUserId())
                .eqIfPresent(SourceApplyDO::getPhone, reqVO.getPhone())
                .betweenIfPresent(SourceApplyDO::getUseEndTime, reqVO.getUseEndTime())
                .eqIfPresent(SourceApplyDO::getApplyReson, reqVO.getApplyReson())
                .eqIfPresent(SourceApplyDO::getFile, reqVO.getFile())
                .eqIfPresent(SourceApplyDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(SourceApplyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SourceApplyDO::getId));
    }

}